home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Language/OS - Multiplatform Resource Library
/
LANGUAGE OS.iso
/
cpp_libs
/
answrbok
/
7_5.lha
/
7_5
/
7_5brect.c
< prev
next >
Wrap
Text File
|
1993-08-08
|
629b
|
26 lines
* Copyright (c) 1990 by AT&T Bell Telephone Laboratories, Incorporated. */
* The C++ Answer Book */
* Tony Hansen */
* All rights reserved. */
/ Exercise 7.5
/ rectangle derived from a line
lass rectangle : public shape
point sw, ne;
friend class line;
ublic:
point north() { return point((sw.x+ne.x)/2,ne.y); }
point east();
point south() { return point((sw.x+ne.x)/2,sw.y); }
point west();
point neast() { return ne; }
point seast();
point swest() { return sw; }
point nwest();
void draw();
void move(int a, int b)
{ sw.x+=a; sw.y+=b; ne.x+=a; ne.y+=b; }
rectangle(point a, point b);
;